Add context to errors thrown by server-start during startup
authorSpencer Baugh <sbaugh@janestreet.com>
Wed, 14 Feb 2024 16:09:33 +0000 (11:09 -0500)
committerEli Zaretskii <eliz@gnu.org>
Sat, 24 Feb 2024 09:19:14 +0000 (11:19 +0200)
When server-start errors during startup, the error is printed to
the terminal without context.  To help the user understand
better what went wrong, that printed error now mentions that the
error came from starting up the daemon.

* lisp/startup.el (command-line): Catch and annotate errors
thrown by server-start.  (bug#68799)

lisp/startup.el

index 1c21b5de857a3bff17d2096bfcf60ddbf5cbdec5..33e1124b9982eca32988c3d3db31287ab4562d1d 100644 (file)
@@ -1639,7 +1639,9 @@ Consider using a subdirectory instead, e.g.: %s"
   (let ((dn (daemonp)))
     (when dn
       (when (stringp dn) (setq server-name dn))
-      (server-start)
+      (condition-case err
+          (server-start)
+        (error (error "Unable to start daemon: %s; exiting" (error-message-string err))))
       (if server-process
          (daemon-initialized)
        (if (stringp dn)